<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
  <title id="oz137116">gpmt gp_log_collector</title>
  <body>
    <p>This tool collects Greenplum and system log files, along with the relevant configuration
      parameters, and generates a file which can be provided to VMware Customer Support for
      diagnosis of errors or system failures.</p>
    <section>
      <title>Usage</title>
      <codeblock><b>gpmt</b> <b>gp_log_collector</b>[<varname>-failed-segs</varname> | -c ID1,ID2,...| <varname>-hostfile FILE</varname> | <varname>-h HOST1, HOST2,...</varname>]
[ -start YYYY-MM-DD ] [ -end YYYY-MM-DD ]
[ -dir PATH ] [ -segdir PATH ] [ -a ]</codeblock>
    </section>
    <section>
      <title>Options</title>
      <parml>
        <plentry>
          <pt><varname>-failed-segs</varname></pt>
          <pd>The tool scans <codeph>gp_configuration_history</codeph> to identify when a segment
            fails over to their mirrors or simply fails without explanation. The relevant content ID
            logs will be collected.</pd>
        </plentry>
        <plentry>
          <pt><varname>-free-space </varname></pt>
          <pd>Free space threshold which will exit log collection if reached. Default value is
            10%.</pd>
        </plentry>
        <plentry>
          <pt><varname>-c</varname></pt>
          <pd>Comma seperated list of content IDs to collect logs from.</pd>
        </plentry>
        <plentry>
          <pt><varname>-hostfile</varname></pt>
          <pd>Hostfile with a list of hostnames to collect logs from.</pd>
        </plentry>
        <plentry>
          <pt><varname>-h</varname></pt>
          <pd>Comma seperated list of hostnames to collect logs from.</pd>
        </plentry>
        <plentry>
          <pt><varname>-start</varname></pt>
          <pd>Start date for logs to collect (defaults to current date).</pd>
        </plentry>
        <plentry>
          <pt><varname>-end</varname></pt>
          <pd>End date for logs to collect (defaults to current date).</pd>
        </plentry>
        <plentry>
          <pt><varname>-a</varname></pt>
          <pd>Answer Yes to all prompts.</pd>
        </plentry>
        <plentry>
          <pt><varname>-dir</varname></pt>
          <pd>Working directory (defaults to current directory).</pd>
        </plentry>
        <plentry>
          <pt><varname>-segdir</varname></pt>
          <pd>Segment temporary directory (defaults to /tmp).</pd>
        </plentry>
        <plentry>
          <pt><varname>-skip-master</varname></pt>
          <pd>When running gp_log_collector, the generated tarball can be very large. Use this
            option to skip Greenplum Master log collection when only Greenplum Segment logs are
            required.</pd>
        </plentry>
        <plentry>
          <pt><varname>-with-gptext</varname></pt>
          <pd>Collect all GPText logs along with the Greenplum logs.</pd>
        </plentry>
        <plentry>
          <pt><varname>-with-gptext-only</varname>
          </pt>
          <pd>Only Collect GPText logs.</pd>
        </plentry>
      </parml>
    </section>
    <p>
      <b>Note</b>: Hostnames provided through <codeph>-hostfile</codeph> or <codeph>-h</codeph> must
      match the hostname column in<codeph> gp_segment_configuration</codeph>.</p>
    <p>The tool also collects the following information:</p>
    <table frame="all" rowsep="1" colsep="1" id="table_j32_5yx_bpb">
      <title>Files</title>
      <tgroup cols="2">
        <colspec colname="c1" colnum="1" colwidth="1.0*"/>
        <colspec colname="c2" colnum="2" colwidth="1.0*"/>
        <thead>
          <row>
            <entry>Source</entry>
            <entry>Files and outputs</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>Database parameters</entry>
            <entry>
              <ul id="ul_kmg_vyx_bpb">
                <li><codeph>version</codeph></li>
                <li><codeph>uptime</codeph></li>
                <li><codeph>pg_db_role_setting</codeph></li>
                <li><codeph>pg_resqueue</codeph></li>
                <li><codeph>pg_resgroup_config</codeph></li>
                <li><codeph>pg_database</codeph></li>
                <li><codeph>gp_segment_configuration</codeph></li>
                <li><codeph>gp_configuration_history</codeph></li>
              </ul>
            </entry>
          </row>
          <row>
            <entry>Segment servers parameters</entry>
            <entry>
              <ul id="ul_cgk_wyx_bpb">
                <li><codeph>uname -a</codeph></li>
                <li><codeph>sysctl -a</codeph></li>
                <li><codeph>psaux</codeph></li>
                <li><codeph>netstat -rn</codeph></li>
                <li><codeph>netstat -i</codeph></li>
                <li><codeph>lsof</codeph></li>
                <li><codeph>ifconfig</codeph></li>
                <li><codeph>free</codeph></li>
                <li><codeph>df -h</codeph></li>
              </ul>
            </entry>
          </row>
          <row>
            <entry>System files from all hosts</entry>
            <entry>
              <ul id="ul_pcy_1zx_bpb">
                <li><codeph>/etc/redhat-release</codeph></li>
                <li><codeph>/etc/sysctl.conf</codeph></li>
                <li><codeph>/etc/sysconfig/network</codeph></li>
                <li><codeph>/etc/security/limits.conf</codeph></li>
              </ul>
            </entry>
          </row>
          <row>
            <entry>Database related files from all hosts</entry>
            <entry>
              <ul id="ul_e45_bzx_bpb">
                <li><codeph>$SEG_DIR/pg_hba.conf</codeph></li>
                <li><codeph>$SEG_DIR/pg_log/</codeph></li>
                <li><codeph>$SEG_DIRE/postgresql.conf</codeph></li>
                <li><codeph>~/gpAdminLogs</codeph></li>
              </ul>
            </entry>
          </row>
          <row>
            <entry>GPText files</entry>
            <entry>
              <ul id="ul_ug1_dzx_bpb">
                <li>Installation configuration file
                    <codeph>$GPTXTHOME/lib/python/gptextlib/consts.py</codeph></li>
                <li><codeph>gptext-state -D</codeph></li>
                <li><codeph>&lt;gptext data dir>/solr*/solr.in</codeph></li>
                <li><codeph>&lt;gptext data dir>/solr*/log4j.properties</codeph></li>
                <li><codeph>&lt;gptext data dir>/zoo*/logs/*</codeph></li>
                <li><codeph>commands/bash/-c_echo $PATH</codeph></li>
                <li><codeph>commands/bash/-c_ps -ef | grep solr</codeph></li>
                <li><codeph>commands/bash/-c_ps -ef | grep zookeeper</codeph></li>
              </ul>
            </entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    <p>Note: some commands might not be able to be run if user does not have enough permission.</p>
    <section>
      <title>Examples</title>
      <p>Collect Greenplum master and segment logs listed in a hostfile from today:</p>
      <codeblock>gpmt gp_log_collector -hostfile ~/gpconfig/hostfile</codeblock>
      <p>Collect logs for any segments marked down from 21-03-2016 until today:</p>
      <codeblock>gpmt gp_log_collector -failed-segs -start 2016-03-21</codeblock>
      <p>Collect logs from host <codeph>sdw2.gpdb.local</codeph> between 2016-03-21 and
        2016-03-23:</p>
      <codeblock>gpmt gp_log_collector -failed-segs -start 2016-03-21 -end 2016-03-21</codeblock>
      <p>Collect only GPText logs for all segments, without any Greenplum logs:</p>
      <codeblock>gpmt gp_log_collector -with-gptext-only</codeblock>
    </section>
  </body>
</topic>
